package com.example.heathy_me.medicineDetail;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.heathy_me.R;

public class MedicineContentFragment extends Fragment {

    private View view;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        view = inflater.inflate(R.layout.medicine_content_frag, container, false);
        return view;
    }

    public void refresh(String medicineTitle, String medicineContent) {
        View visibilityLayout = view.findViewById(R.id.visibility_layout);
        visibilityLayout.setVisibility(View.VISIBLE);
        TextView medicineTitleText = (TextView) view.findViewById (R.id.medicine_title);
        TextView medicineContentText = (TextView) view.findViewById(R.id.medicine_content);
        medicineTitleText.setText(medicineTitle); // 刷新标题
        medicineContentText.setText(medicineContent); // 刷新内容
    }

}

